package com.kinyx.framework.db.vo;

import java.lang.reflect.Field;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

import com.kinyx.framework.annotation.assist.CanNotNull;

class MappingHandlerHelper {

	static String Entity$name(@CanNotNull final Class<?> clazz) {
		final Entity annotation = clazz.getAnnotation(Entity.class);
		return annotation != null ? annotation.name() : null;
	}

	static String Table$name(@CanNotNull final Class<?> clazz) {
		final Table annotation = clazz.getAnnotation(Table.class);
		return annotation != null ? annotation.name() : null;
	}

	static String Column$name(@CanNotNull final Field field) {
		final Column annotation = field.getAnnotation(Column.class);
		return annotation != null ? annotation.name() : null;
	}

	static Boolean Column$insertable(@CanNotNull final Field field) {
		final Column annotation = field.getAnnotation(Column.class);
		return annotation != null ? annotation.insertable() : null;
	}

	static Boolean Column$updatable(@CanNotNull final Field field) {
		final Column annotation = field.getAnnotation(Column.class);
		return annotation != null ? annotation.updatable() : null;
	}

}
